package com.xqboss.common.core.text;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.BeanProperty;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.ContextualSerializer;
import com.xqboss.common.annotation.DataMask;
import com.xqboss.common.annotation.PercentFormat;
import com.xqboss.common.enums.DataMaskEnum;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.Objects;

public final class PercentSerializer extends JsonSerializer<BigDecimal> {

    @Override
    public void serialize(BigDecimal value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
        gen.writeNumber(value.multiply(new BigDecimal(100)).toPlainString());
    }

}

